package com.gukewen;

import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.function.Function;

/**
 * @ClassName MessageProcessorA
 * @Description
 * @Author gu
 * @Date 2025/11/4 15:12
 * @Version 1.0
 **/

@Component
public class MessageProcessorA {

    @Bean
    public Function<String, String> processA() {
        return input -> {
            System.out.println("🟢 模块A收到消息：" + input);
            // 拼接后返回，Spring Cloud Stream 会把返回值发送到 processA-out-0 (topic-b)
            return input + " -> 模块A收到消息";
        };
    }
}